/**
 * Created by kenz on 2018/3/7.
 */
import axios from 'axios'
import { host } from './config'
export function httpPost(url, options) {
  return new Promise((resolve, reject) => {
    axios.post(host + url, options).then(res => {
      const { data, msg, code } = res.data
      console.log(res.data)
      if(code == 0) {
        resolve(data)
      } else {
        reject(code, msg)
      }
    }).catch(err => {
      reject(10009, 'catch error')
    })
  })
}
